#ifndef YCCOREATTENTION_H
#define YCCOREATTENTION_H

#include "modeltype.h"
#include <QJsonObject>

namespace yc {

struct Attention
{
    int id = 0;
    int presenter = 0;
    int status = 0;
    int category = 0;
    bool auto_check = false;
    bool auto_record = false;

    Attention() { }
    Attention(int i, int p, int s) : id(i), presenter(p), status(s) { }
    explicit Attention(const QJsonObject& jo) { this->operator=(jo); }

    Attention& operator=(const QJsonObject& jo)
    {
        id = jo["id"].toInt();
        presenter = jo["presenter"].toInt();
        status = jo["status"].toInt();
        category = jo["category"].toInt();
        auto_check = false; // jo["autoCheck"].toBool(false);
        auto_record = jo["autoRecord"].toBool(false);
        return *this;
    }

    QJsonObject toJsonObject() const
    {
        return QJsonObject { { "id", id },
                             { "presenter", presenter },
                             { "status", status },
                             { "category", category },
                             { "autoCheck", auto_check },
                             { "autoRecord", auto_record } };
    }
};

} // namespace yc

#endif // YCCOREATTENTION_H
